import Platform
import pygame
image_s=pygame.image.load("saw.jpg")
image_s.set_colorkey((137,44,75))

class PowerSaw(Platform.Platform):
	def __init__(self,pos=(0,0),im=image_s,cutt_pos=0,cutt_speed=0.05,cutt_right=True):
		Platform.Platform.__init__(self,pos,im)
		self.c_cutting_pos=cutt_pos
		self.cutting_speed=cutt_speed
		self.right=cutt_right
	def process(self):
		if self.right:
			self.c_cutting_pos=self.c_cutting_pos+self.cutting_speed
			if self.c_cutting_pos>=1.0:
				self.c_cutting_pos=2.0-self.c_cutting_pos
				self.right=False
		else:
			self.c_cutting_pos=self.c_cutting_pos-self.cutting_speed
			if self.c_cutting_pos<=0.0:
				self.c_cutting_pos=-self.c_cutting_pos
				self.right=True
		
	def drawingInformation(self):
		return (self.pos[0]+self.c_cutting_pos*(300-image_s.get_width()),self.pos[1]),image_s
	def objectLanding(self,objecto):
		if self.pos[0]+self.c_cutting_pos*(300-image_s.get_width())<=objecto.x<=self.pos[0]+self.c_cutting_pos*(300-image_s.get_width())+image_s.get_width():
			if objecto.y<self.pos[1]<objecto.y+objecto.getHeight():
				objecto.die()
	def pointOfPlatform(self,x,y):
		return y==self.pos[1] and self.pos[0]+self.c_cutting_pos*(300-image_s.get_width())<=x<=self.pos[0]+self.c_cutting_pos*(300-image_s.get_width())+image_s.get_width()